﻿namespace WMS6.Web.TransportManagement
{
    using System;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using WMS6.Web;

    public class DispatchQuery : BasePage
    {
        protected Button btnExport;
        protected Button btnList;
        protected Button btnSearch;
        protected DropDownList ddlArrivedTime;
        protected DropDownList ddlCreateBy;
        protected DropDownList ddlCustomerID;
        protected DropDownList ddlDeliveryOrderID;
        protected DropDownList ddlDeliveryOrderType;
        protected DropDownList ddlDeliveryOrderTypeOper;
        protected DropDownList ddlOrderID;
        protected DropDownList ddlOwnerID;
        protected DropDownList ddlTransferType;
        protected DropDownList ddlTransferTypeOper;
        protected HtmlForm F8020;
        protected HtmlInputHidden hdnActionID;
        protected Label lblArrivedTime;
        protected Label lblBu;
        protected Label lblCreateBy;
        protected Label lblCustomerID;
        protected Label lblDeliveryOrderID;
        protected Label lblDeliveryOrderType;
        protected Label lblOrderID;
        protected Label lblOwnerID;
        protected Label lblTransferType;
        protected HtmlLink mycss;
        protected ScriptManager ScriptManager1;
        protected TextBox txtArrivedTime;
        protected TextBox txtCreateBy;
        protected TextBox txtCustomerID;
        protected TextBox txtDeliveryOrderID;
        protected TextBox txtOrderID;
        protected TextBox txtOwnerID;

        protected void btnList_Click(object sender, EventArgs e)
        {
            base.Server.Transfer(string.Format("DispatchList.aspx?action={0}&from=list", base.UrlEncode(this.hdnActionID.Value.Trim())), false);
        }

        protected void btnSearch_Click(object sender, EventArgs e)
        {
            base.Server.Transfer(string.Format("DispatchList.aspx?action={0}", base.UrlEncode(this.hdnActionID.Value.Trim())), false);
        }

        private void LoadDll()
        {
            base.BindData2DDLBySysCode(this.ddlDeliveryOrderTypeOper, "DeliveryType");
            this.ddlDeliveryOrderTypeOper.Items.Insert(0, new ListItem("-----", ""));
            base.BindData2DDLBySysCode(this.ddlTransferTypeOper, "TransportMode");
            this.ddlTransferTypeOper.Items.Insert(0, new ListItem("-----", ""));
            base.InitQueryDDL(this.ddlDeliveryOrderID, 0);
            base.InitQueryDDL(this.ddlOrderID, 0);
            base.InitQueryDDL(this.ddlOwnerID, 0);
            base.InitQueryDDL(this.ddlCustomerID, 0);
            base.InitQueryDDL(this.ddlArrivedTime, 0);
            base.InitQueryDDL(this.ddlTransferType, 0);
            base.InitQueryDDL(this.ddlDeliveryOrderType, 0);
            base.InitQueryDDL(this.ddlCreateBy, 0);
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!base.IsPostBack)
            {
                base.InitPage(this.Page);
                this.LoadDll();
            }
        }

        public string ArrivedTime
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtArrivedTime.Text.Trim()))
                {
                    return base.GetParamsString(this.txtArrivedTime.Text.Trim(), this.ddlArrivedTime.SelectedValue);
                }
                return "";
            }
        }

        public string CreateBy
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtCreateBy.Text.Trim()))
                {
                    return base.GetParamsString(this.txtCreateBy.Text.Trim(), this.ddlCreateBy.SelectedValue);
                }
                return "";
            }
        }

        public string CustomerID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtCustomerID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtCustomerID.Text.Trim(), this.ddlCustomerID.SelectedValue);
                }
                return "";
            }
        }

        public string DeliveryOrderID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtDeliveryOrderID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtDeliveryOrderID.Text.Trim(), this.ddlDeliveryOrderID.SelectedValue);
                }
                return "";
            }
        }

        public string DeliveryOrderType
        {
            get
            {
                if (!string.IsNullOrEmpty(this.ddlDeliveryOrderTypeOper.SelectedValue))
                {
                    return base.GetParamsString(this.ddlDeliveryOrderTypeOper.SelectedValue, this.ddlDeliveryOrderType.SelectedValue);
                }
                return "";
            }
        }

        public string OrderID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtOrderID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtOrderID.Text.Trim(), this.ddlOrderID.SelectedValue);
                }
                return "";
            }
        }

        public string OwnerID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtOwnerID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtOwnerID.Text.Trim(), this.ddlOwnerID.SelectedValue);
                }
                return "";
            }
        }

        public string TransferType
        {
            get
            {
                if (!string.IsNullOrEmpty(this.ddlTransferTypeOper.SelectedValue))
                {
                    return base.GetParamsString(this.ddlTransferTypeOper.SelectedValue, this.ddlTransferType.SelectedValue);
                }
                return "";
            }
        }
    }
}

